package com.tianqu.tms.www.transfer.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tianqu.tms.core.base.TmsAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.util.TmsConstants;
import com.tianqu.tms.entity.TransferAcceptedInfo;
import com.tianqu.tms.www.transfer.actionform.TransferRgActionForm;
import com.tianqu.tms.www.transfer.controller.TransferSeniorChangeJYPResultController;
import com.tianqu.tms.www.transfer.viewhelper.TransferRgInputViewHelper;

public class TransferSeniorChangeJYPResultAction extends TmsAction {

	@Override
	protected ActionForward doAction(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response,
			UserContext uc) throws Exception {
		TransferRgActionForm inForm = (TransferRgActionForm)form;
		TransferRgInputViewHelper view =(TransferRgInputViewHelper)uc.getAttribute(TmsConstants.VIEWHELP);
		uc.setAttribute("serial", view.getSerial());
		if((inForm.getVendorCodeOld()==null||"".equals(inForm.getVendorCodeOld()))
				&&(inForm.getCarTypeOld()==null||"".equals(inForm.getCarTypeOld()))
				&&(inForm.getRegisterCardNoOld()==null||"".equals(inForm.getRegisterCardNoOld()))
				&&(inForm.getCarMarketInOld()==null||"".equals(inForm.getCarMarketInOld()))
				&&(inForm.getCarOwnerOld()==null||"".equals(inForm.getCarOwnerOld()))
				&&(inForm.getCarOwnerIdCardNoOld()==null||"".equals(inForm.getCarOwnerIdCardNoOld()))
				&&(inForm.getOwnerOrgNoOld()==null||"".equals(inForm.getOwnerOrgNoOld()))
				&&(inForm.getOwnerAddressOld()==null||"".equals(inForm.getOwnerAddressOld()))
				&&(inForm.getOwnerPhoneOld()==null||"".equals(inForm.getOwnerPhoneOld()))
				&&(inForm.getNewCarOwnerOld()==null||"".equals(inForm.getNewCarOwnerOld()))
				&&(inForm.getNewcarOwnerIdCardNoOld()==null||"".equals(inForm.getNewcarOwnerIdCardNoOld()))
				&&(inForm.getNewOwnerOrgNoOld()==null||"".equals(inForm.getNewOwnerOrgNoOld()))
				&&(inForm.getNewOwnerAddressOld()==null||"".equals(inForm.getNewOwnerAddressOld()))
				&&(inForm.getNewOwnerPhoneOld()==null||"".equals(inForm.getNewOwnerPhoneOld()))
				&&(inForm.getTransferPriceOld()==null||"".equals(inForm.getTransferPriceOld()))
				&&(inForm.getTaxNoOld()==null||"".equals(inForm.getTaxNoOld()))
				&&(inForm.getTransNoOld()==null||"".equals(inForm.getTransNoOld()))
				&&(inForm.getTransMarketOld()==null||"".equals(inForm.getTransMarketOld()))
				&&(inForm.getNewAgentNameOld()==null||"".equals(inForm.getNewAgentNameOld()))
				&&(inForm.getNewAgentOwnerIdCardNoOld()==null||"".equals(inForm.getNewAgentOwnerIdCardNoOld()))
				&&(inForm.getNewAgentAddressOld()==null||"".equals(inForm.getNewAgentAddressOld()))
				&&(inForm.getNewAgentPhoneOld()==null||"".equals(inForm.getNewAgentPhoneOld()))
			    &&(inForm.getOwnerTypeOld()==null || "".equals(inForm.getOwnerTypeOld()))
			    &&(inForm.getNewOwnerTypeOld()==null || "".equals(inForm.getNewOwnerTypeOld()))
			   
			    &&(inForm.getTransferTypeOld()==null || "".equals(inForm.getTransferTypeOld()))
		)
		{
			//没有任何修改，请确认修改后再保存！
			setErrorsToRequest(request, TmsConstants.IM014, null);
			return mapping.getInputForward();
		}

		isToken(mapping, request);
		TransferSeniorChangeJYPResultController controller = new TransferSeniorChangeJYPResultController();
		controller.execute(uc);
		
		uc.removeAttribute(TmsConstants.VIEWHELP);
		return mapping.findForward(TmsConstants.SUCCESS);
	}

}
